const webpack = require('webpack')
const htmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path')
module.exports = {
    entry : './src/monitor.js',
    output: {
        filename: 'dist.js'
    },
    module: { // 所有第三方模块的匹配规则， webpack默认只能处理.js后缀名的文件，需要安装第三方loader
        rules: []
    },
    plugins: [
        new webpack.HotModuleReplacementPlugin(),
        new htmlWebpackPlugin({
            template: path.join(__dirname, './index.html'),
            filename: 'index.html'
        })
    ],
    mode:'development',
    devtool:'source-map', // 支持source-map 本地调试
    devServer: {
        // index.html 直接使用 / 来标识 public 文件夹路径
        static: {
          directory: path.join(__dirname, 'public'),
        },
        compress: true,
        port: 9000,
    },
}